# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=gjs
pkgver=1.68.3
pkgrel=1
epoch=2
pkgdesc="Javascript Bindings for GNOME"
url="https://wiki.gnome.org/Projects/Gjs"
arch=(x86_64)
license=(GPL)
depends=(cairo gobject-introspection-runtime js78 dconf readline)
makedepends=(gobject-introspection git meson dbus)
checkdepends=(valgrind xorg-server-xvfb gtk3 gtk4)
provides=(libgjs.so)
_commit=44999624184db531715fcf65721c1882b4a748bc  # tags/1.68.3^0
source=("git+https://gitlab.gnome.org/GNOME/gjs.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  arch-meson $pkgname build \
    --buildtype release \
    -D installed_tests=false \
    -D profiler=disabled
  meson compile -C build
}

check() {
  xvfb-run -s '-nolisten local' \
    meson test -C build --print-errorlogs
}

package() {
  depends+=(libreadline.so)
  meson install -C build --destdir "$pkgdir"
}
